#ifndef STATEBOARD_H
#define STATEBOARD_H

#include <QWidget>

namespace Ui {
class StateBoard;
}

enum GPS_STATE{
    G_NO,
    G_GPS,
    G_RTK,
};
enum CONTROL_STATE{
    C_MANUAL,
    C_AUTO,
    C_REMOTE,
};
enum EMERGEN_SWITCH_STATE{
    E_OFF,
    E_ON,
};
enum LIDAR_STATE{
    L_ERROR,
    L_NORMAL,
};
enum VISION_STATE{
    V_ERROR,
    V_NORMAL,
};

class StateBoard : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(qreal voltage READ voltage WRITE setVoltage)//电压
    Q_PROPERTY(bool state4G READ state4G WRITE setState4G)//4G信号状态
    Q_PROPERTY(int stateGps READ stateGps WRITE setStateGps)//GPS信号状态
    Q_PROPERTY(int controlState READ controlState WRITE setControlState)//控制状态，手动，自动，遥控
    Q_PROPERTY(int switchState READ switchState WRITE setSwitchState)//紧急开关状态
    Q_PROPERTY(int lidarState READ lidarState WRITE setLidarState)//雷达状态
    Q_PROPERTY(int visionState READ visionState WRITE setVisionState)//视觉传感器状态
    Q_PROPERTY(int speed READ speed WRITE setSpeed)//速度
public:

public:
    explicit StateBoard(QWidget *parent = 0);
    ~StateBoard();

    qreal voltage() const;
    bool state4G() const;
    int stateGps() const;
    int controlState() const;
    int switchState() const;
    int lidarState() const;
    int visionState() const;

    int speed() const;


public slots:
    void setVoltage(qreal voltage);
    void setState4G(bool state4G);
    void setStateGps(int stateGps);
    void setControlState(int controlState);
    void setSwitchState(int switchState);
    void setLidarState(int lidarState);
    void setVisionState(int visionState);

    void setSpeed(int speed);

    void carInfo(QStringList info);
private:
    Ui::StateBoard *ui;
    qreal m_voltage;
    bool m_state4G;
    GPS_STATE m_stateGps;
    CONTROL_STATE m_controlState;
    EMERGEN_SWITCH_STATE m_switchState;
    LIDAR_STATE m_lidarState;
    VISION_STATE m_visionState;
    int m_speed;

    void setDriveMode(QString driveMode);
};

#endif // STATEBOARD_H
